package com.qfedu.work;

import com.qfedu.utils.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class WorkProduce {
    public static void main(String[] args)throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare("work_queue",true,false,false,null);
        for (int i = 0; i < 30; i++) {
            String message = "hello!welcome to qfedu!"+i;
            channel.basicPublish("","work_queue",null,message.getBytes());
        }
        //关闭资源
        channel.close();
        connection.close();

    }


}
